<template>
    <div>
        <h2>parent = 父组件的数据{{num_p}} </h2>
        <h2>age== 父组件的数据{{age}} </h2>
        <h1>cont=={{cont}}</h1>
    
<button @click="change_num_p">点击我修改父元素的数据</button>
<button @click="changen_age">点击我修改子元素的数据通过ref</button>

        <hr>
        <Childone :num_p="num_p" ref="one" :changeone="changeone"></Childone>
    </div>
</template>
<script>
import Childone from "./Childone.vue"
export default {
    data() {
        return {
            num_p:2000,
            cont:20,
            age:30
        }
    },
    methods: {
        change_num_p(){
            this.num_p+=100
        },
         changen_age(){
            this.$refs.one.age+=5
        },
        changeone(){
            this.cont+=10
        }
    },
    mounted() {
       
    },
    components:{
        Childone
    }
}
</script>